home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Video
/
World of Video.iso
/
gfxprograms
/
3dprograms
/
rayshade-4.0
/
fixes
/
fix001
next >
Wrap
Internet Message Format
|
1995-02-13
|
8KB
From theseas!fs.Princeton.EDU!cek Sat, 23 Jan 93 01:35:28 EET
Received: by kriton.UUCP (V1.16/Amiga)
id AA00000; Sat, 23 Jan 93 01:35:28 EET
Received: by theseas.ntua.gr with UUCP; Fri, 22 Jan 93 04:36:19 +0200
Received: from mcsun.EU.net by pythia.ics.forth.gr via ITEnet with SMTP;
id AA15276 (5.65c/FORTH-ICS-3.0-MHS-7.0); Fri, 22 Jan 1993 04:30:48 +0200
Received: by mcsun.EU.net via EUnet
id AA02595 (5.65b/CWI-2.204); Fri, 22 Jan 1993 03:28:40 +0100
Received: from Princeton.EDU by relay2.UU.NET with SMTP
(5.61/UUNET-internet-primary) id AA13671; Thu, 21 Jan 93 21:27:55 -0500
Received: from fs.Princeton.EDU by Princeton.EDU (5.65b/2.95/princeton)
id AA11439; Thu, 21 Jan 93 21:26:59 -0500
Received: by fs.Princeton.EDU (4.1/1.105)
id AA05809; Thu, 21 Jan 93 21:26:56 EST
Received: from po2.andrew.cmu.edu by fs.Princeton.EDU (4.1/1.105)
id AA05715; Thu, 21 Jan 93 21:26:11 EST
Received: by po2.andrew.cmu.edu (5.54/3.15) id <AA15503@X> for rayshade-users@cs.princeton.edu; Thu, 21 Jan 93 21:26:02 EST
Received: via switchmail; Thu, 21 Jan 1993 21:26:02 -0500 (EST)
Received: from klotho.weh.andrew.cmu.edu via qmail
ID </afs/andrew.cmu.edu/service/mailqs/q002/QF.IfLpfrK00VpAQ0gUkS>;
Thu, 21 Jan 1993 21:24:55 -0500 (EST)
Received: from klotho.weh.andrew.cmu.edu via qmail
ID </afs/andrew.cmu.edu/usr14/kf1o/.Outgoing/QF.YfLpfXy00VpAMCiUYy>;
Thu, 21 Jan 1993 21:24:37 -0500 (EST)
Received: from Messages.7.15.N.CUILIB.3.45.SNAP.NOT.LINKED.klotho.weh.andrew.cmu.edu.pmax.ul4
via MS.5.6.klotho.weh.andrew.cmu.edu.pmax_ul4;
Thu, 21 Jan 1993 21:24:34 -0500 (EST)
Message-Id: <YfLpfWq00VpAECiUR0@andrew.cmu.edu>
Date: Thu, 21 Jan 1993 21:24:34 -0500 (EST)
Errors-To: Princeton.EDU!cek
Remailed-Date: Thu Jan 21 21:26:13 EST 1993
From: Karl Frederik Fischer <cmu.edu!k+>
To: cs.Princeton.EDU!rayshade-users
Subject: bug fixes
Hello Rayshade users,
I have fixed a few bugs with the '-c' (continue) option. These bugs
showed up while I was running Rayshade distributed using some fancy
shell scripts. I do these distributed runs on machines available in
public clusters here at CMU. When someone logs onto the console of one
of these machines foreign processes are terminated, so a reliable '-c'
is very important to me.
I just joined the Rayshade mailing list so I don't know whether these
bugs are news to you. I am working from Rayshade 4.0 patchlevel 6. My
bug fixes are included below in "patch" format. Here are the
explanations of my changes:
- When playing animations made by distributed rendering I noticed an
annoying jitter from frame to frame. It turned out that each time an
image was continued with '-c', one row of pixels was dropped at the
point where rendering was interrupted. All the rows above the missing
row were shifted down by one and a blank row was left at the top. These
artifacts are hardly noticeable in single frames, but when playing
animations in which some frames are missing rows and others aren't, the
resulting jitter is quite noticeable. I finally discovered the problem
to be a subtlety of the RLE image format. Each row of pixels in an RLE
image is preceded by a "newline" sequence EXCEPT for the first row.
When an RLE image is reopened for appending, the RLE library thinks it
is at the first row even though it isn't. A "newline" gets left out so
the first row of new pixels "overwrites" the last row of old pixels when
the image is displayed. The solution I found is to manually insert a
"newline" using rle_skiprow() except when there is no pixel data in the
image file (which means rendering was interrupted right after the header
was written).
- When '-c' is used on a file that doesn't exist, Rayshade prints an
error message and exits. For my distributed rendering purposes it was
useful to change this behaviour so that Rayshade will print a warning,
create the file, and proceed with rendering. This is not a bug fix,
just an interface change, so do what you like with it. Right now the
warning just goes to stderr; I'm not sure whether this is the right
thing to do in Rayshade's error handling scheme.
- An image is complete when Screen.miny > Screen.maxy, not when
Screen.miny >= Screen.maxy. Screen.miny is the y-coordinate of the
first row which hasn't been rendered yet. When Screen.miny ==
Screen.maxy there is still one row left to render.
- I simplified count_rle_rows() by using rle_getskip() instead of
rle_getraw(). Also I fixed a bug resulting from the assumption that a
complete image will have data for every row. This assumption is wrong!
When completely blank rows appear at the top of the image, absolutely
NOTHING is written to the image file for these rows! This behaviour
(which I assume is one the RLE library's ways of compressing images) can
cause Rayshade to append to an already complete image and corrupt it.
The solution I found is to check for physical EOF. If the image file
has not reached physical EOF after skipping all the row data, then it
must have reached a logical EOF marker (part of the RLE format). A
logical EOF means the image is complete, regardless of the amount of row
data.
I hope you find these patches useful. Feel free to use or modify them
any way you like.
- Karl
---PATCH FILE-----CUT HERE---
*** libshade/picture.c.orig Sun Feb 9 22:04:06 1992
--- libshade/picture.c Sat Jan 16 00:11:14 1993
***************
*** 86,91 ****
--- 86,96 ----
Options.imgname);
rle_dflt_hdr.rle_file = Options.pictfile;
rle_put_init(&rle_dflt_hdr);
+ /*
+ * Append "linefeed" to last line in outfile.
+ */
+ if (Screen.miny > rle_dflt_hdr.ymin)
+ rle_skiprow(&rle_dflt_hdr, 1);
} else {
/*
* Starting image from scatch.
***************
*** 153,160 ****
*/
Options.pictfile = fopen(Options.imgname, "r");
if (Options.pictfile == (FILE *)NULL) {
! RLerror(RL_ABORT, "Cannot open image file %s.\n",
! Options.imgname);
}
rle_dflt_hdr.rle_file = Options.pictfile;
rle_get_setup_ok(&rle_dflt_hdr, "rayshade", Options.imgname);
--- 158,168 ----
*/
Options.pictfile = fopen(Options.imgname, "r");
if (Options.pictfile == (FILE *)NULL) {
! fprintf(stderr,
! "Cannot open image file \"%s\". Creating new file.\n",
! Options.imgname);
! Options.appending = FALSE;
! return;
}
rle_dflt_hdr.rle_file = Options.pictfile;
rle_get_setup_ok(&rle_dflt_hdr, "rayshade", Options.imgname);
***************
*** 193,199 ****
* Determine number of scanlines written to file.
*/
Screen.miny += count_rle_rows(&rle_dflt_hdr);
! if (Screen.miny >= Screen.maxy) {
fprintf(stderr, "\"%s\" is a complete image.\n",
Options.imgname);
exit(0);
--- 201,207 ----
* Determine number of scanlines written to file.
*/
Screen.miny += count_rle_rows(&rle_dflt_hdr);
! if (Screen.miny > Screen.maxy) {
fprintf(stderr, "\"%s\" is a complete image.\n",
Options.imgname);
exit(0);
***************
*** 204,230 ****
}
static int
! count_rle_rows( hdr )
rle_hdr *hdr;
{
! rle_op **raw;
! int *nraw, y, ynext;
! if (rle_raw_alloc( hdr, &raw, &nraw ) < 0) {
! RLerror(RL_PANIC,
! "Unable to allocate memory in count_rle_rows.\n");
! }
! y = hdr->ymin;
! while ((ynext = rle_getraw( hdr, raw, nraw )) != 32768) {
! y = ynext+1;
! rle_freeraw( hdr, raw, nraw );
! }
! /* Free memory. */
! rle_raw_free( hdr, raw, nraw );
!
! return y - hdr->ymin;
}
/*
--- 212,234 ----
}
static int
! count_rle_rows(hdr)
rle_hdr *hdr;
{
! int y, ynext;
! for (y = hdr->ymin - 1; (ynext = rle_getskip(hdr)) != 32768; y = ynext)
! ;
! /*
! * If we have not reached physical EOF, then we must be at logical EOF
! * which means the image is complete regardless of the amount of
! * scanline data present.
! */
! if (!feof(hdr->rle_file))
! y = hdr->ymax;
! return y - hdr->ymin + 1;
}
/*
----------
Administrivia: rayshade-request@cs.princeton.edu
Mailing list: rayshade-users@cs.princeton.edu